class @AdminCategoryListingModel extends ListingModel

    @ListingUrl:''

    initialize: ->
        if AdminCategoryListingModel.ListingUrl.length==0
            AdminCategoryListingModel.ListingUrl = SiteMap.Admin.Categories.Listing

    defaults:
        Size: 10
        Page: 1
        Direction: 0
        Categories: []
        Column: "Name"
        Filter:
            Name: ''

    url: ->
        url = AdminCategoryListingModel.ListingUrl
        url = url + "?page=" + @attributes.Page
        url = url + "&size=" + @attributes.Size
        url = url + "&Column=" + @attributes.Column
        url = url + "&Direction=" + @attributes.Direction
        url = url + "&Filter.Name=" + @attributes.Filter.Name
        SiteMap.Admin.Categories.Listing = encodeURI(url)
        return SiteMap.Admin.Categories.Listing

    parse: (response) ->
        attrs = {
            Size: response.Size
            Page: response.Page
            TotalPages: response.TotalPages
            Column: response.Column
            Direction: response.Direction
            Filter: @attributes.Filter
        }

        attrs.Categories = response.Categories
        if response.Filter.Name?
            attrs.Filter.Name = response.Filter.Name

        return attrs